
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import httpRequest from './API/httpRequest'
import uView from "uview-ui";
import TMap from "./libs/qqmap-wx-jssdk.js"
import common from './common/common.js'
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;
Vue.use(uView)
// Vue.prototype.$https = httpRequest
Vue.config.productionTip = false
App.mpType = 'app'

Vue.prototype.$https = httpRequest
Vue.prototype.TMap=TMap
const app = new Vue({
    ...App
})
import httpInterceptor from '@/common/http.interceptor.js'
Vue.use(httpInterceptor, app)

import httpApi from '@/common/http.api.js'
Vue.use(httpApi, app)
app.$mount()


//消息提示信息
Vue.prototype.toastMsg = function(msg) {
	uni.showToast({
		title: msg,
		icon: 'none',
		duration: 1500
	})
	return false;
}
//消息loding动画效果
Vue.prototype.LoadingMsg = function(msg) {
	uni.showLoading({
		title: msg
	})
	return false;
}
Vue.prototype.back = function() {
	uni.navigateBack({
		delta: 1
	})
};
//数字10检测
Vue.prototype.formatNum = function(num) {
	return num < 10 ? '0' + num : num + '';
}
//剩余天数
Vue.prototype.formatDay = function(num) {
	var date = new Date();
	var until = new Date(num);
	var days = (until - date) / 1000 / 3600 / 24;
	var day = Math.floor(days);
	return day;
}
/**
 * 基本的域名
 */
// Vue.prototype.baseUrl = 'http://bkda.kaigekeji.com';
Vue.prototype.baseUrl = 'https://glht.ckjkj.com';

// 扩展this 跳转地址;
// url
// type
// prs
Vue.prototype.$goPage = function() {
	// console.log('跳转页面')
	let args = arguments;
	let url = "";
	let type = "";
	let prs = undefined;

	if (args && args.length > 0) {
		for (let i = 0; i < args.length; i++) {
			let item = args[i];

			if (typeof item == "string") {
				if (url) {
					type = item;
				} else {
					url = item;
				}
			} else if (typeof item == "object") {
				prs = item;
			}
		}
	}

	type = type || "navigateTo";

	let paramsStr = "";
	let paramsStrs = [];

	if (prs) {
		paramsStrs.push("?");

		for (let key in prs) {
			if (typeof prs[key] != "undefined") {
				paramsStrs.push(`${key}=${encodeURIComponent(prs[key])}`);
			}
		}

		paramsStr = paramsStrs.join("&");
	}

	if (url) {
		url = url + paramsStr;

		switch (type) {
			case "navigateTo":
			case "to":
				//前往某个页面
				uni.navigateTo({
					url
				});
				break;
			case "redirectTo":
			case "closeMe":
				//关闭自己，前往某个页面
				uni.redirectTo({
					url
				});
				break;
			case "reLaunch":
			case "closeAll":
				//关闭全部页面，前往某个页面
				uni.reLaunch({
					url
				});
				break;
			case "switchTab":
			case "toTab":
				//关闭全部非Tab页面，前往某个tab
				uni.switchTab({
					url
				});
				break;
		}
	}
};







// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif